home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !preview / RCS / h / d2rd next >
Encoding:
Text File  |  1990-07-24  |  5.1 KB  |  286 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    gtoal:1.2;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     91.03.02.13.59.42;  author gtoal;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     91.03.02.13.56.32;  author gtoal;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @Initial release
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @IAY's update
  28. @
  29. text
  30. @/* d2rd.h */
  31.  
  32. #include "wimpt.h"  /* includes wimp.h and os.h */
  33. #include "menu.h"
  34. #include "sprite.h"
  35.  
  36. #undef FALSE
  37. #undef TRUE
  38.  
  39. #define FALSE             (0!=0)
  40. #define TRUE              (0==0)
  41.  
  42. #define PROGRAM_NAME      "Preview"
  43.  
  44. #define HOME_DIRECTORY    "Preview$Dir"
  45.  
  46. #define SAVEAS_OKBUTTON      (0)
  47. #define SAVEAS_FILENAME      (2)
  48. #define SAVEAS_FILEICON      (3)
  49.  
  50. #define ABS(X)               ((X) >= 0 ? (X) : -(X))
  51. #define SGN(X)               ((X) > 0 ? 1 : (X) < 0 ? -1 : 0)
  52.  
  53. /* DVI-82 files have a special filetype, so double-clicking makes d2rd load
  54.    the file automagically.  On a double-click, this _must_ be the file type; 
  55.    on a drag it doesn't matter.  */
  56.  
  57. #define FILE_TYPE_DVI     (0xce4)
  58.  
  59. /*
  60. ** The following numbers define the size of a sheet
  61. ** of paper, in inches.
  62. */
  63. #define A4_WIDTH          8.27
  64. #define A4_HEIGHT         11.69
  65.  
  66. struct text
  67. {
  68.   unsigned int text:24, font:8;
  69.   int x, y, rx, ty;
  70. };
  71.  
  72.  
  73. struct rule
  74. {
  75.   int x, y, w, h;
  76. };
  77.  
  78.  
  79. struct font_use
  80. {
  81.   char *name;
  82.   int size;              /* in 16ths of a point.  */
  83. };
  84.  
  85.  
  86. struct page
  87. {
  88.   struct page *next;
  89.  
  90.   struct text *texts;
  91.   int text_max;
  92.  
  93.   struct rule *rules;
  94.   int rule_max;
  95.  
  96.   char *chars;
  97.   int char_max;
  98.  
  99.   /* Number of things on this page.  This is used to display a percent
  100.      hourglass when building a sprite.  */
  101.   int things;
  102.  
  103.   /* 0 if this pages is not completed yet.  1 otherwise.  */
  104.   int complete;
  105.  
  106.   /* The cardinal number of this page.  */
  107.   int dvi_page;
  108.  
  109.   int tex_pages[10];
  110. };
  111.  
  112.  
  113. struct dvi_file
  114. {
  115.   struct dvi_file *next;
  116.   char *f_name;
  117.   struct font_use *fonts[256];
  118.   struct page *pages;
  119.   int height, width;
  120.   int complete;
  121. };
  122.  
  123.  
  124. struct display
  125. {
  126.   struct display *next;
  127.   struct dvi_file *file;
  128.   struct page *page;
  129.  
  130.   int w_handle;
  131.   char *w_title;
  132.  
  133.   sprite_id sid;
  134.   sprite_area *area;
  135.  
  136.   /*
  137.   ** The size of the page in millipoints
  138.   */
  139.   int hor_size, ver_size;
  140.  
  141.   /*
  142.   ** TeX does not specify the positioning of the information on the page,
  143.   ** but the default assumed is 1 inch offset from the topleft corner.
  144.   ** Expressed in millipoints.
  145.   */
  146.   int hor_offset, ver_offset;
  147.  
  148.   /* MAGSTEP is an index into the array
  149.      TEX_MAGSTEP of magsteps (ordered like the magstep submenu).
  150.      ZOOM is the power of two of the zooming level (default = 0).  */
  151.  
  152.   int magstep, zoom;
  153.  
  154.    /*
  155.    ** Variable, normally 1.0, which may be tweaked by the
  156.    ** main program to change scaling by non-Magstep amounts,
  157.    ** for example to match physical pixels on the screen.
  158.    */
  159.    double mag_tweak;
  160. };
  161.  
  162. /*
  163. ** Definitions of how many of a particular kind of thing
  164. ** there are to an inch.
  165. */
  166. #define MILLIPOINTS 72000
  167.  
  168. extern struct display *windows;
  169. extern struct dvi_file *dvi_files;
  170. extern struct dvi_file *current_dvi_file;
  171.  
  172. /* My task handle.  */
  173.  
  174. extern wimp_t pid;
  175.  
  176.  
  177. /* Our programname$dir thingy.  */
  178.  
  179. extern char *progdir;
  180.  
  181.  
  182. /* The iconhandle of our icon on the iconbar.  */
  183.  
  184. extern wimp_i iconbar_icon;
  185.  
  186.  
  187. /* (buttons.c) WHICH_MENU points to the display structure of the window above
  188.    which this menu popped up.  It is NULL if the menu was the iconbar menu.  */
  189.  
  190. extern struct display *which_menu;
  191.  
  192.  
  193. /* */
  194.  
  195. extern menu goto_page;
  196.  
  197.  
  198. extern wimp_w saveas;
  199.  
  200.  
  201. /* The current screen mode.  */
  202.  
  203. extern int vdu_mode;
  204.  
  205.  
  206.  
  207. extern int monitor_type;
  208. extern int x_os_scale, y_os_scale;
  209. extern char goto_page_buffer[];
  210. extern int loading_a_file;
  211. extern wimp_menustr *iconbar_menu;
  212. extern menu window_menu, mag_menu, saveas_menu;
  213. extern wimp_mousestr menu_pos;
  214. extern char *version_string;
  215. extern int saveas_filetype;
  216. extern char *saveas_buffer;
  217.  
  218.  
  219. /* */
  220.  
  221. extern os_error *err;
  222.  
  223. extern int fatal (const char *, ...);
  224. extern void tfatal (const char *, ...);
  225. extern void *xmalloc (int);
  226. extern void *xcalloc (int, int);
  227. extern void *xrealloc (void *, int);
  228. extern void handle_buttons (wimp_eventdata *);
  229. extern int read_a_file (char *);
  230. extern void dviread_main (int, char **);
  231. extern void do_a_poll (void);
  232. extern void fill_sprite (struct display *);
  233. extern void factors (struct display *, double *, double *);
  234. extern void delete_display (wimp_w);
  235. extern void adjust_window_size (struct display *);
  236. extern int define_sprite (struct display *);
  237. extern void set_window_title (struct display *);
  238.  
  239. /* EOF d2rd.h */
  240. @
  241.  
  242.  
  243. 1.1
  244. log
  245. @Initial revision
  246. @
  247. text
  248. @a16 2
  249. #define ONE_OS_INCH       (180)
  250.  
  251. d30 6
  252. a35 7
  253.  
  254. #define XA4_AT_95DPI      784
  255.  
  256. #define YA4_AT_95DPI      1104
  257.  
  258.  
  259. #define MAGNIFICATION_DIVISOR (90000.0)   /* which is 90 dpi * magstep0.  */
  260. a36 1
  261.  
  262. d107 3
  263. a109 2
  264.   /* The size of the page in pixels.  */
  265.  
  266. d112 5
  267. a116 4
  268.   /* TeX does not specify the positioning of the information on the page,
  269.      but the default assumed is 1 inch offset from the topleft corner
  270.      Unit = 1/72000th inch.  */
  271.  
  272. d119 1
  273. a119 1
  274.   /* DPI is straight the dots per inch.  MAGSTEP is an index into the array
  275. d123 1
  276. a123 2
  277.   int dpi, magstep, zoom;
  278. };
  279. d125 13
  280. a184 1
  281. extern int tex_magstep[];
  282. d204 1
  283. a204 1
  284. extern void factors (struct display *, int *, int *);
  285. @
  286.